@(categoryList: List[Category], path: String, docs: List[Doc], topReplyUsers: List[User], topViewDocs: List[Doc], topReplyDocs: List[Doc], page: Int, total: Int)(implicit request: RequestHeader)

@import utils.RequestHelper
@main(s"${App.siteSetting.name} - 社区文档", "doc") {
<div class="main layui-clear">
  <div class="wrap">
    <div class="content">
      <div class="fly-tab">
        <div class="layui-tab layui-tab-brief">
          <ul class="layui-tab-title">
            <li> <a href="/docs" @if(path == "/"){class="layui-this"}>全部</a> </li>
            @for(c <- categoryList){
            <li> <a href="/docs?path=@c.path" @if(path == c.path){class="layui-this"}>@c.name</a> </li>
            }
          </ul>
        </div>
        <i class="layui-icon fly-search">&#xe615;</i>
      </div>

      <ul class="fly-panel fly-list">
        @for(a <- docs){
        <li class="fly-list-li">
          <a href="/user/home?uid=@{a.author._id}" class="fly-list-avatar">
            <img src="@a.author.headImg" alt="">
          </a>
          <h2 class="fly-tip">
            <a href="/doc/view?_id=@a._id">@a.title</a>
          </h2>
          <p>
            <span><a href="/user/home?uid=@{a.author._id}">@a.author.name</a></span>
            <span>@utils.DateTimeUtil.toPrettyString(a.timeStat.createTime)</span>
            <span><a href="/docs?path=@{a.categoryPath}&page=@page">@a.categoryName</a></span>
            <span class="fly-list-hint">
              <i class="layui-icon" title="收藏">&#xe600;</i> @a.collectStat.count
              <i class="iconfont icon-zan" title="点赞"></i> @a.voteStat.count
              <i class="iconfont" title="回答">&#xe60c;</i> @a.replies.size
              <i class="iconfont" title="人气">&#xe60b;</i> @a.viewStat.count
            </span>
          </p>
        </li>
        }
      </ul>

      <div style="text-align: center">
        <div class="laypage-main">
          <a href="/docs?page=@{page-1}" class="laypage-prev">上一页</a><span>@{if(docs.isEmpty){0}else{page}}/@{math.ceil(total/15.0).toInt}</span><a href="/docs?page=@{page+1}" class="laypage-next">下一页</a></div>
      </div>

    </div>
  </div>

  <div class="edge">
    @if(RequestHelper.isAdmin){
    <div class="jie-add">
      <a href="/doc/add" class="layui-btn layui-btn-big">创建文档</a>
      <a href="/user" class="layui-btn layui-btn-big layui-btn-normal" style="margin-left: 10px;">我的文档</a>
    </div>
    }
    <div class="fly-panel leifeng-rank">
      <h3 class="fly-panel-title">回答月榜</h3>
      <dl>
        @for(u <- topReplyUsers){
        <dd>
          <a href="/user/home?uid=@u._id">
            <img src="@{u.setting.headImg}">
            <cite>@{u.setting.name}</cite>
            <i>@{u.stat.replyCount}次回答</i>
          </a>
        </dd>
        }
      </dl>
    </div>

    <dl class="fly-panel fly-list-one">
      <dt class="fly-panel-title">近期热文</dt>
      @for(a <- topViewDocs){
      <dd>
        <a href="/doc/view?_id=@{a._id}">@a.title</a>
        <span><i class="iconfont">&#xe60b;</i> @a.viewStat.count</span>
      </dd>
      }
    </dl>

    <dl class="fly-panel fly-list-one">
      <dt class="fly-panel-title">近期热议</dt>
      @for(a <- topReplyDocs){
      <dd>
        <a href="/doc/view?_id=@{a._id}">@a.title</a>
        <span><i class="iconfont">&#xe60c;</i> @a.replyStat.count</span>
      </dd>
      }
    </dl>

    <div class="fly-panel fly-link">
      <h3 class="fly-panel-title">友情链接</h3>
      <dl>
        @for(l <- App.siteSetting.links){
        <dd>
          <a href="@l.url" target="@l.target">@l.title</a>
        </dd>
        }
      </dl>
    </div>
  </div>
</div>
}

<script>
</script>
